Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Node / ReticulumProjects / MeshChatX.git / files / scripts / build-macos-universal.sh

Displaying Raw • Download


scripts/build-macos-universal.sh v4.6.0-rc.2 (7bbe9846) Text, 2.25 KB

T8b949e#!/usr/bin/env bash
T8b949e# Build darwin-arm64 and darwin-x64 cx_Freeze backends, then electron-builder --mac --universal.
T8b949e# On Apple Silicon, the x64 backend must be built with an x86_64 Python (e.g. Homebrew in /usr/local).
T8b949e# Set PYTHON_CMD_X64 to that interpreter if Poetry's default env is arm64-only.
Tffa657set -euo pipefail

Te6edf3ROOTTff7b72=Ta5d6ff"Tff7b72$(Tffa657cd Ta5d6ff"Tff7b72$(dirname Ta5d6ff"Te6edf3$0Ta5d6ff"Tff7b72)Ta5d6ff/..Ta5d6ff" Tff7b72&& Tffa657pwdTff7b72)Ta5d6ff"
Tffa657cd Ta5d6ff"Te6edf3$ROOTTa5d6ff"

T8b949e# @electron/universal merges x64 and arm64 app bundles and requires every non-binary
T8b949e# file present in both trees to have identical bytes. Per-arch backend-manifest.json
T8b949e# contents always differ, so skip embedding it here; electron/main.js treats a missing
T8b949e# manifest as "skip integrity check" (see verifyBackendIntegrity).
Tffa657export Te6edf3MESHCHATX_SKIP_BACKEND_MANIFESTTff7b72=T79c0ff1

pnpm run electron-postinstall
pnpm run version:sync
T8b949e# Skip frontend rebuild when CI provides a prebuilt meshchatx/public artifact
T8b949e# via the reusable Frontend build workflow. Local invocations leave the flag
T8b949e# unset and continue to build everything from source.
Tff7b72if Tff7b72[Tff7b72[ Ta5d6ff"Tffd700${Te6edf3MESHCHATX_FRONTEND_PREBUILTTff7b72:-Te6edf30Tffd700}Ta5d6ff" !Tff7b72= Ta5d6ff"1" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
pnpm run build-frontend
pnpm run build-docs
pnpm run build-repository-wheels
Tff7b72else
Tff7b72if Tff7b72[Tff7b72[ ! -f Ta5d6ff"meshchatx/public/index.html" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
Tffa657echo Ta5d6ff"MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >Tb4b4b4&T79c0ff2
Tffa657echo Ta5d6ff"Download the frontend artifact into meshchatx/public/ before invoking this script." >Tb4b4b4&T79c0ff2
Tffa657exit T79c0ff1
Tff7b72fi
Tffa657echo Ta5d6ff"Reusing prebuilt frontend assets in meshchatx/public/."
Tff7b72fi
cross-env Te6edf3ARCHTff7b72=arm64 pnpm run build-backend
Tff7b72if Tff7b72[Tff7b72[ -n Ta5d6ff"Tffd700${Te6edf3PYTHON_CMD_X64Tff7b72:-Tffd700}Ta5d6ff" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
cross-env Te6edf3ARCHTff7b72=x64 Te6edf3PYTHON_CMDTff7b72=Ta5d6ff"Te6edf3$PYTHON_CMD_X64Ta5d6ff" pnpm run build-backend
Tff7b72else
cross-env Te6edf3ARCHTff7b72=x64 pnpm run build-backend
Tff7b72fi

T8b949e# @electron/universal v2.x checks SHA equality for every non-Mach-O file
T8b949e# and throws if any differ (no x64ArchFiles escape for PLAIN files).
T8b949e# cx_Freeze's library.zip contains only architecture-independent Python
T8b949e# bytecode; the per-arch native extensions (.dylib/.so) live outside the
T8b949e# zip. The two zips differ solely in .pyc header timestamps and zip
T8b949e# metadata, so copying one over the other is safe and makes the merge pass.
bash scripts/unify-backend-plain-files.sh

Tffa657exec pnpm Tffa657exec electron-builder --mac --universal --publishTff7b72=never


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────